<template>
    <div class="route-panel">
        <div v-show="drivingRoute.length" class="has-data">
            <div class="line-title">
                <div>{{ drivingTitle }}</div>
                <div class="close-icon">
                    <CloseCircleOutlined style="font-size: 16px" @click="outClick" />
                </div>
            </div>
            <div class="line-content">
                <div class="start">起点</div>
                <div class="line-body">
                    <div class="line"></div>
                    <div class="line-desc">
                        <p v-for="(item, i) in drivingRoute" :key="i">{{ item }}</p>
                    </div>
                </div>
                <div class="end">终点</div>
            </div>
        </div>
        <div v-show="!drivingRoute.length" class="empty-data"> 暂无数据</div>
    </div>
</template>
<script setup lang="ts">
    import { CloseCircleOutlined } from '@ant-design/icons-vue';

    const props = defineProps({
        drivingRoute: {
            type: Array,
            default: () => [],
        },
        drivingTitle: {
            type: String,
            default: '',
        },
    });
    const emit = defineEmits(['outClick']);

    function outClick() {
        emit('outClick', false);
    }
</script>
<style scoped lang="less">
    .route-panel {
        .line-title {
            position: relative;
            margin-bottom: 9px;
            font-size: 14px;
            font-weight: 700;
            color: rgba(255, 255, 255, 0.8);

            .close-icon {
                position: absolute;
                top: 1px;
                right: -13px;
            }
        }

        .line-content {
            font-size: 12px;

            .start {
                display: flex;
                align-items: center;

                &::before {
                    content: '起';
                    color: #fff;
                    width: 20px;
                    height: 20px;
                    margin-right: 7px;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    border-radius: 50%;
                    background: #1478f5;
                }
            }

            .end {
                display: flex;
                align-items: center;

                &::before {
                    content: '终';
                    color: #fff;
                    width: 20px;
                    height: 20px;
                    margin-right: 7px;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    border-radius: 50%;
                    background: #1478f5;
                }
            }

            .line-body {
                display: flex;
                //max-height: 370px;
            }

            .line {
                width: 1px;
                //max-height: 370px;
                background-color: #1478f5;
                margin: 5px 19px 5px 8px;
            }

            .line-desc {
                flex: 1;
            }
        }

        .empty-data {
            margin-top: 30%;
            text-align: center;
        }
    }
</style>
